# print("hello world!")
import random
target_num = random.randint(1,10)
guess_num = 3
for i in range(guess_num):
    while True:
        user_num = input("你猜猜1-10之间我选择哪个数字")
        if user_num.isdigit():
            user_num = int(user_num)
            break
        else:
            print("输入的不是整数哦，请重新输入")
    if int(user_num) == target_num:
        print("恭喜你猜对了")
        break
    else:
        if i != guess_num -1:
            if user_num > target_num:
                print(f"你猜的数字{user_num}比较大，再试试吧")
            else:
                print(f"你猜的数字{user_num}比较小，再试试吧")
        else:
            print(f"猜错了，正确答案是{target_num}")

print("游戏结束")